Arshdeep225615024/feature/shift matching system#385
Conversation
|
is this endpoint part of exsisting shift system or will it be a seperate section? |
| { id: user._id, role: user.role }, | ||
| process.env.JWT_SECRET, | ||
| { expiresIn: '1h' } | ||
| { expiresIn: '12h' } |
There was a problem hiding this comment.
why did you increase the token expiry
@neethuchandhavarkar are you fine with this?
There was a problem hiding this comment.
I increased the token expiry for testing purposes, as it was not feasible to create multiple employers and guards, and log back in every hour from postman. We can revert it back now, no problem
| return rangeA.start < rangeB.end && rangeB.start < rangeA.end; | ||
| }; | ||
|
|
||
| const getSuitabilityLevel = (score) => { |
There was a problem hiding this comment.
what is your logic for score?
we already do have a guard rating system, are you using that? or created something
There was a problem hiding this comment.
he scoring system is a lightweight recommendation layer built on top of the existing guard data and workflows. It does not replace the existing guard rating system.
The current score combines multiple operational factors including:
availability match
live availability status
conflicting shifts
verified licence status
employer favourites
same suburb/location match
existing guard rating
The existing guard rating is already included as one component of the overall suitability score. The intention was to create a broader staffing suitability recommendation rather than relying only on review ratings.
For now this shift matching system acts as a recommendation system for employers to get most suitable guards for their shifts , It was intentionally made to not change the current shift matching system, but It can be definitely be extended as a complete shift matching system by future students as I have also included the invitation feature (from employer to guards) |






Shift Matching and Invitation System
Overview
This pull request introduces a new intelligent Shift Matching and Invitation System for the SecureShift backend. The feature allows employers to generate ranked guard recommendations for shifts and invite suitable guards through a structured workflow.
The implementation was designed with minimal disruption to the existing shift lifecycle and assignment system.
Features Implemented
Intelligent Shift Matching
Added a new endpoint:
GET /api/v1/shift-matches/:shiftId
The system generates ranked guard recommendations based on:
Suitability Ranking
Replaced simple boolean suitability with ranking levels:
Each guard recommendation also includes:
Conflict Detection
Implemented overlapping shift conflict detection.
The system now identifies:
Conflicting guards receive reduced scores.
Guard Preference System
Added a new
GuardPreferencemodel.Guards can store:
Endpoints added:
Shift Invitation System
Added a new
ShiftInvitationmodel.Employers can invite guards directly from match results.
Endpoint added:
Invitation Management
Guards can:
Endpoints added:
Role-Based Access Control (RBAC)
Added security restrictions:
Swagger Documentation
All new functionality has been documented under:
Swagger documentation includes:
Workflow
Employer creates shift
→ System generates ranked guard matches
→ Employer invites selected guard
→ Guard views invitation
→ Guard accepts/declines invitation
Future Enhancements
Planned future improvements include:
Notes
This implementation was intentionally designed to avoid major modifications to the existing shift creation, application, and assignment workflow, ensuring compatibility with the current backend architecture.